package com.tang.user.controller;

import com.sun.org.apache.xpath.internal.operations.Mult;
import com.tang.common.exception.RecruitExceptionEnum;
import com.tang.common.uniform.Result;
import com.tang.common.utils.UpLoad;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
public class UploadController {

    @RequestMapping("/upload")
    public Result upload(MultipartFile file) {
        String upload = null;
        if (file != null) {
            upload = UpLoad.upload(file);
        }
        if (upload != null) {
            System.out.println(upload);
            return Result.success(upload);
        }
        return Result.error(RecruitExceptionEnum.UPLOAD_FAILED);
    }
}
